$(function () {
    $(".set-button").bind("click", function () {
        var objhtml = $(".set-box").html();
        parent.layer.open({
            area: '650px',
            type: 1,
            title: false,
            closeBtn: 0,
            shadeClose: true,
            skin: 'yourclass',
            content: objhtml
        });
    });
    $("#zpname").bind("click", function () {
        var objhtml = $(".set-box").html();
        parent.layer.open({
            area: '650px',
            type: 1,
            title: "",
            shadeClose: true,
            skin: 'yourclass',
            content: objhtml
        });
    });
    $(".promote-layer").bind("click", function () {
        var objhtml = $(this).data('href');
        parent.layer.open({
            area: ['600px', "500px"],
            type: 2,
            title: false,
            closeBtn: 2,
            shadeClose: true,
            skin: 'yourclass',
            content: objhtml
        });
    });
    $(".recharge").bind("click", function () {
        var obj = $(this);
        var id = obj.data("id"),
                name = obj.data("name"),
                account = obj.data("account");
        var objhtml = $(".set-box").html();
        parent.layer.open({
            area: '650px',
            type: 1,
            title: false,
            closeBtn: 0,
            shadeClose: true,
            skin: 'yourclass',
            content: objhtml,
            success: function () {
                var a = $(window.parent.document);
                a.find("input[name='bus_id']").val(id);
                a.find("#com-name").html(name);
                a.find("#s_account").html(account);

            },
        });
    });
//查看大图
    $(".file-img img").bind("click", function () {
        var obj = $(this).parent().html();
        parent.layer.open({
            type: 1,
            title: false,
            closeBtn: 1,
            area: ['60%'],
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: obj
        });
    });
//点击按钮查看大图
    $(".big-img").bind("click", function () {
        var obj = $(this).next(".file-img").html();
        parent.layer.open({
            type: 1,
            title: false,
            closeBtn: 1,
            area: ['60%'],
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: obj
        });
    });
//重新认证
    $(".vip-test").bind("click", function () {
        parent.layer.confirm('你确定要用户重新认证吗？', {
            btn: ['确认', '取消'], //按钮
            title: '操作提示',
            icon: 3
        });
    });

//退款弹窗
    $(".refund").bind("click", function () {
        var name = $(this).parents("tr").find("td").eq(1).html();
        var money = $(this).parents("tr").find("td").eq(7).html();
        parent.layer.confirm('你确定要对' + name + '，进行' + money + '元退款操作吗？', {
            btn: ['确认', '取消'], //按钮
            title: '操作提示',
            icon: 3
        });
    });
});

//弹窗表单处理
function demoform(url, jsondata) {
    $.ajax({
        type: "post",
        url: url,
        data: jsondata,
        datatype: "json",
        success: function (data) {
            var list = eval(data);
            if (list.status == 1) {
                parent.layer.msg(list.info, {time: 2000}, function () {
                    window.parent.frames[0].location.reload();
                    $(".layui-layer-close").click();
                });
            } else {
                parent.layer.msg(list.info);
            }
        },
        error: function () {
            parent.layer.msg("操作失败");
        }
    });
}